<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('订单信息列表')" />
    <th:block th:include="include :: select2-css" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <p>订单类型：</p>
                                <select name="orderType" class="form-control" th:with="type=${@dict.getType('order_type')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <p>充值服：</p>
                                <input type="text" name="server"/>
                            </li>
                            <li>
                                <p>充值区：</p>
                                <input type="text" name="area"/>
                            </li>
                            <li class="select-time">
                                <p>订单完成时间：</p>
                                <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginFinishTime]"/>
                                <span>-</span>
                                <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endFinishTime]"/>
                            </li>
                            <li>
                                <p>订单状态：</p>
                                <select name="orderState" class="form-control" th:with="type=${@dict.getType('orderState')}">
                                    <option value="">所有</option>
                                    <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                                </select>
                            </li>
                            <li>
                                <p>交易单价：</p>
                                <input type="text" name="orderPrice"/>
                            </li>
                            <li>
                                <p>购买数量：</p>
                                <input type="text" name="buyNum"/>
                            </li>
                            <li>
                                <p>外部订单ID：</p>
                                <input type="text" name="customerOrderNo"/>
                            </li>
                            <li>
                                <p>充值账号：</p>
                                <input type="text" name="chargeAccount"/>
                            </li>
                            <li>
                                <p>商品名称：</p>
                                <input type="text" name="productName"/>
                            </li>
                            <li>
                                <p>商品Id：</p>
                                <input type="text" name="productId"/>
                            </li>
                            <li>
                                <p>订单编号：</p>
                                <input type="text" name="orderId"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
<!--                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="fulu:order:add">-->
<!--                    <i class="fa fa-plus"></i> 添加-->
<!--                </a>-->
<!--                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="fulu:order:edit">-->
<!--                    <i class="fa fa-edit"></i> 修改-->
<!--                </a>-->
<!--                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="fulu:order:remove">-->
<!--                    <i class="fa fa-remove"></i> 删除-->
<!--                </a>-->
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="fulu:order:export">
                    <i class="fa fa-download"></i> 导出
                 </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: select2-js" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('fulu:order:edit')}]];
        var removeFlag = [[${@permission.hasPermi('fulu:order:remove')}]];
        var orderType = [[${@dict.getType('order_type')}]];
        var orderState = [[${@dict.getType('order_state')}]];
        var prefix = ctx + "fulu/order";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "订单信息",
                columns: [{
                    checkbox: true
                },
                {
                    field : 'id',
                    title : 'id',
                    visible: false
                },
                {
                    field : 'orderId',
                    title : '订单编号'
                },
                {
                    field : 'activityProductId',
                    title : '活动商品Id'
                },
                {
                    field : 'productId',
                    title : '商品Id'
                },
                {
                    field : 'productName',
                    title : '商品名称'
                },
                {
                    field : 'chargeAccount',
                    title : '充值账号'
                },
                {
                    field : 'customerOrderNo',
                    title : '外部订单ID'
                },
                {
                    field : 'createTime',
                    title : '创建时间'
                },
                {
                    field : 'buyNum',
                    title : '购买数量'
                },
                {
                    field : 'orderPrice',
                    title : '交易单价'
                },
                {
                    field : 'orderState',
                    title : '订单状态',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(orderState, value);
                    }
                },
                {
                    field : 'finishTime',
                    title : '订单完成时间'
                },
                {
                    field : 'area',
                    title : '充值区'
                },
                {
                    field : 'server',
                    title : '充值服'
                },
                {
                    field : 'type',
                    title : '计费方式'
                },
                {
                    field : 'orderType',
                    title : '订单类型',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(orderType, value);
                    }
                },
                {
                    field : 'operatorSerialNumber',
                    title : '运营商流水号'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        if (row.orderType == 3){
                            actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="showCardList(\'' + row.id + '\')"><i class="fa fa-edit"></i>查看卡密</a> ');
                        }
                        return actions.join('');
                    }
                }
                ]
            };
            $.table.init(options);
        });

        function showCardList(orderId){
            $.modal.open("卡密列表", prefix + "/cardList/" + orderId,1000);
        }

    </script>
</body>
</html>